<template>
    <div class="xm-register">
        <van-nav-bar title="面经注册" />
        <XmForm @onSubmit="onSubmit" btnClass="xm-register-submit" />
        <router-link class="xm-register-submit" to="/login"
            >有账号，去登录</router-link
        >
    </div>
</template>

<script>
import XmForm from '@/components/XmForm.vue'
import { REGISTER_API } from '@/constant/api'
import HttpTools from '@/utils/http'

export default {
  name: 'XmRegister',
  components: {
    XmForm
  },
  methods: {
    onSubmit (form) {
      HttpTools.post(REGISTER_API, form).then(() => {
        this.$router.push('/login')
      })
    }
  }
}
</script>

<style lang="less" scoped>
.xm-register {
    .xm-register-submit {
        width: 100%;
        display: inline-block;
        text-align: right;
        color: #016799;
        font-size: 12px;
        padding: 0 16px;
        box-sizing: border-box;
    }
}
</style>
